home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr47 / asmwin13.zip / WINDOWS.DOC < prev   
Text File  |  1989-01-24  |  4KB  |  103 lines

  1. Module  : WINDOWS.ASM - Assembly level windowing routines
  2. Author  : Thomas Hill
  3. Version : 1.0
  4. Date    : 01/20/89
  5.  
  6. This is a set of assembly routines, written for use with Borlands TASM
  7. assembler, which provides the primitive routines neede to manage windows
  8. in assembly code.
  9.  
  10. Thanks to Dave Bennett for the underlying direct video routines "VIDEO.ASM",
  11. also included in this archive file.
  12.  
  13. The following routines are provided:
  14.  
  15. ---------------------------
  16.     InitWindows  Prepare the window arrays, check for available DOS memory.
  17.                  If DOS reports no avialable memory, then the routine returns
  18.                  with the CARRY flag SET.
  19.                  Note that InitWindows will save the current contents of the
  20.                  screen into window #0.  If your program calls EraseTopWin
  21.                  just before exitting, the screen which was present at the
  22.                  time the windows were initialized will be restored.
  23.                  If you DO NOT do this, you will leave 4K of allocated
  24.                  memory in the DOS memory chain which cannot be used.
  25.  
  26. ---------------------------
  27.  
  28.     MakeWindow - Create a window record in the array of possible windows.
  29.                  Passed to the routine are the following:
  30.  
  31.                    AH - Top left row
  32.                    AL - left column
  33.                    BH - Number of rows
  34.                    BL - Number of columns
  35.                    CL - various flags:
  36.                          Bit 0 = 1  Save the underlying screen
  37.                          Bit 1 = 1  Frame the window
  38.                          Bit 2 = 1  Clear the window
  39.                    DH - Frame Attribute ( See VIDEO.INC for values)
  40.                    DL - Background attribute for clear
  41.                 DS:SI - Null terminated title for the window(20 chars max)
  42.  
  43.                  On return if CARRY is SET, something went wrong.
  44.                  Otherwise a 'window handle' is returned in AL.
  45.  
  46. ----------------------
  47.  
  48.     DispWindow - Display a specified window.
  49.                  This routine will display the requested window.
  50.                  If the title specified for the window fits, and a frame
  51.                  has been specified, the title will appear centered at 
  52.                  the top.
  53.  
  54.                    AL - Window handle
  55.  
  56.                  On return if CARRY is SET, something went wrong.
  57.                  Otherwise, the requested window is displayed.
  58.  
  59. ------------------------
  60.  
  61.     EraseTopWin - Erases the 'top' window on the screen.  If the
  62.                   underlying screen was saved, it is restored.
  63.                   The previously defined window is made active.
  64.  
  65.                   No input parameters
  66.  
  67.                   On return if CARRY is SET, something went wrong.
  68.  
  69. ------------------------
  70.  
  71.    WWriteStr  -  Write a null terminated string to the current window.
  72.                  If the string is too long it will be clipped.
  73.                  If the row,column starting point of the string is
  74.                  'outside' the current window, nothing is written.
  75.  
  76.                    DS:SI - pointer to null terminated string.
  77.                    AH - Row
  78.                    AL - Col
  79.                    BH - Attribute to use during write
  80.  
  81.                  On return if the string was not written,
  82.                  the CARRY will be SET.
  83.  
  84.  
  85. Some notes on usage here:
  86.  
  87.     If you will examine the demo program, you will find a routine called
  88.     'ReSizeMem'.  THis routine computes (roughly) the size of the program
  89.     and releases to DOS all unused memory.  This is needed because the 
  90.     windowing routines request their memory areas for screen saves from
  91.     DOS via the Allocate Memory Block call.  If the memory is not released,
  92.     there is no memory to use for screen saves, and the windowing routines
  93.     will not work.
  94.     I did it this way because I didn't want to pre-allocate worst case sized
  95.     memory (4K per window).  The method of requesting memory from DOS is
  96.     very much like the heap in PASCAL.  A future version will attempt to
  97.     first get the memory areas from EMS memory, then try the DOS calls.
  98.  
  99.     The code may not be the world's best, I wasn't aiming for super compact
  100.     or highest speed.  The last time I worked in assembly was in the 8080/Z80
  101.     days, and I am out of practice.  Give me time, I'll get better!
  102.  
  103.